home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH5 / 5-2-6.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-19  |  3.1 KB  |  95 lines

  1. VERSION 5.00
  2. Begin VB.Form frmFICA 
  3.    Caption         =   "FICA Taxes"
  4.    ClientHeight    =   2616
  5.    ClientLeft      =   1656
  6.    ClientTop       =   1740
  7.    ClientWidth     =   4092
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   7.8
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   2616
  20.    ScaleWidth      =   4092
  21.    Begin VB.PictureBox picTax 
  22.       Height          =   495
  23.       Left            =   120
  24.       ScaleHeight     =   444
  25.       ScaleWidth      =   3804
  26.       TabIndex        =   5
  27.       Top             =   1920
  28.       Width           =   3855
  29.    End
  30.    Begin VB.CommandButton cmdCalculate 
  31.       Caption         =   "Calculate FICA Taxes"
  32.       Height          =   495
  33.       Left            =   120
  34.       TabIndex        =   4
  35.       Top             =   1200
  36.       Width           =   3855
  37.    End
  38.    Begin VB.TextBox txtCurrent 
  39.       Height          =   285
  40.       Left            =   2760
  41.       TabIndex        =   3
  42.       Top             =   720
  43.       Width           =   1215
  44.    End
  45.    Begin VB.TextBox txtToDate 
  46.       Height          =   285
  47.       Left            =   2760
  48.       TabIndex        =   1
  49.       Top             =   240
  50.       Width           =   1215
  51.    End
  52.    Begin VB.Label lblCurrent 
  53.       Alignment       =   1  'Right Justify
  54.       Caption         =   "Earnings for the current pay period "
  55.       Height          =   495
  56.       Left            =   720
  57.       TabIndex        =   2
  58.       Top             =   600
  59.       Width           =   1935
  60.    End
  61.    Begin VB.Label lblToDate 
  62.       Alignment       =   1  'Right Justify
  63.       Caption         =   "Total earnings for this year prior to the current pay period "
  64.       Height          =   615
  65.       Left            =   0
  66.       TabIndex        =   0
  67.       Top             =   120
  68.       Width           =   2655
  69.    End
  70. Attribute VB_Name = "frmFICA"
  71. Attribute VB_GlobalNameSpace = False
  72. Attribute VB_Creatable = False
  73. Attribute VB_PredeclaredId = True
  74. Attribute VB_Exposed = False
  75. Private Sub cmdCalculate_Click()
  76.   Dim FicaTaxes As Single
  77.   FicaTaxes = FICA(Val(txtToDate.Text), Val(txtCurrent.Text))
  78.   picTax.Cls
  79.   picTax.Print "Your FICA taxes for the current"
  80.   picTax.Print "pay period are "; FormatCurrency(FicaTaxes)
  81. End Sub
  82. Private Function FICA(ytdEarnings As Single, curEarnings As Single) As Single
  83.   Dim socialSecurityBenTax As Single, medicare As Single
  84.   'Calculate Social Security benefits tax and Medicare tax
  85.   'for a single pay period in 1999
  86.   socialSecurityBenTax = 0
  87.   If (ytdEarnings + curEarnings) <= 72600 Then
  88.       socialSecurityBenTax = 0.062 * curEarnings
  89.     ElseIf ytdEarnings < 72600 Then
  90.       socialSecurityBenTax = 0.062 * (72600 - ytdEarnings)
  91.   End If
  92.   medicare = 0.0145 * curEarnings
  93.   FICA = socialSecurityBenTax + medicare
  94. End Function
  95.